package com.slliver.sentinelservice.openfeign.interceptor;

import feign.RequestInterceptor;
import feign.RequestTemplate;
import org.springframework.stereotype.Component;

import java.util.UUID;


@Component
public class TokenRequestInterceptor implements RequestInterceptor {
    /**
     * 请求拦截器
     * @param requestTemplate
     */
    @Override
    public void apply(RequestTemplate requestTemplate) {
        //System.out.println("openfeign ==>> 自定义的请求拦截器已经生效...");
        requestTemplate.header("X-token", "token123456=" + UUID.randomUUID().toString());
    }
}
